var Role_Path = JSON.parse(localStorage.getItem("role_Path"));

$(function(){
    //权限 begin  
    for (var k = 0; k < Role_Path.length; k++) {
        if (Role_Path[k].path == '/antifraud/inquiry/frdnet.json') {
            $("#relationBtn").show();
            continue;
        } 
        else if (Role_Path[k].path == '/antifraud/inquiry/inquiry.json') {
            $("#inquiryBtn").show();
            continue;
        }
    }
    //权限 end
})
var ORG_NUM = null, product_obj = {};

// 产品
function getProduct(){ 
    jQuery.ajax({
        url: "../../shcp/antifraud/inquiry/listProduct.json",
        type: "get",
        async: false,
        success: function(data){
            for (var i = 0; i < data.length; i++) {
                product_obj[data[i].PRODUCT_NUM] = data[i].PRODUCT_NAME
            }
        }
        })
}

function getCityCode(code) {
    var cityName = "";
    if (code) {
        if (code.length == 6) {
            var pCode = code.slice(0, 2);
            var sCode = code.slice(0, 4);
            var pName = CityCodes[pCode + "0000"];
            var sName = CityCodes[sCode + "00"];
            var cName = CityCodes[code];
            if (code.slice(2, 6) == "0000") {
                if (pName) {
                    cityName = pName.trim();
                }
            } else if (code.slice(4, 6) == "00") {
                if (pName && sName) {
                    cityName = pName.trim() + sName.trim();
                }
            } else {
                if (pName && sName && cName) {
                    cityName = pName.trim() + sName.trim() + cName.trim();
                }
            }
        }
    }
    return cityName;
}

function getAppReq(appid) {
    //antifraud/api/__/appReq?APP_ID=0413dc78-f621-4a55-80c6-c98bf1f265e8   
    if (!isEmpty(appid)) {
        var qstr = {
            "appId": appid
        };
        jQuery.ajax({
            type: "GET",
            url: "../../shcp/antifraud/inquiry/appReq.json",
            cache: false,
            data: qstr,
            success: function (retData) {
                checkAuth(retData);
                //              console.log(retData);
                //              retJson = JSON.parse(retData);
                //              
                renderAppReq(retData);
            },
            error: function (retData) {
                return null;
            }
        });
    }
}

function getAppRst(appid) {
    //antifraud/api/__/appRst?APP_ID=0413dc78-f621-4a55-80c6-c98bf1f265e8   
    if (!isEmpty(appid)) {
        var qstr = {
            "appId": appid
        };
        jQuery.ajax({
            type: "GET",
            url: "../../shcp/antifraud/inquiry/appRst.json",
            cache: false,
            data: qstr,
            success: function (retData) {
                checkAuth(retData);
                //retJson = JSON.parse(retData);
                renderAppRst(retData);
            },
            error: function (retData) {
                return null;
            }
        });
    }
}

function riskLevelFormatter(score) {
    if (score == null || score == "") {
        return "";
    } else if (score <= 530) {
        return '高欺诈风险';
    } else if (score > 570) {
        return '低欺诈风险';
    } else {
        return '中欺诈风险';
    }
}

function packReqItem(key, value) {
    if (!isEmpty(key) && !isEmpty(value)) {
        // 忽略该字段
        if (key === "APP_STATUS") {
            return false;
        }
        if (key === "ID_HASH") {
            $("#ID_NUM")[0].innerText = value;
        } else if (key === "CELL_PHONE_HASH") {
            $("#CELL_PHONE")[0].innerText = value;
        } else if (key === "APP_NUM") {
            $("#APP_NUM_REQ")[0].innerText = value;
            //$("#APP_NUM_RST")[0].innerText = value;
        } else if (key === "APP_DATE") {
            $("#APP_DATE_REQ")[0].innerText = value;
        } else if ((key === "ORG_NUM") && (value != null)) {
            ORG_NUM = value;
        } else if (key === "BIZ_CITY") {
            $("#BIZ_CITY")[0].innerText = getCityCode(value);
        } else {
            var mapValues = ServiceResultMap[key];
            if (mapValues) {
                var text = mapValues[value];
                if (text) {
                    value = text.trim();
                }
                // 字典中没有就用原始值
                // else
                //  value = "";
            }
            ele = document.getElementById(key);
            if (!isEmpty(ele)) {
                ele.innerText = value;
            }
        }
    }
}

function renderAppReq(reqData) {
    if (!isEmpty(reqData)) {
        if (reqData.RET_CODE === "00") {
            if (!reqData.DATA.FRD_PRODUCT_NUM ||
                (!!reqData.DATA.FRD_PRODUCT_NUM && reqData.DATA.FRD_PRODUCT_NUM.indexOf("AFP100") >= 0)) {
                $('.relationBtn').bind('click', function () {
                    doViewAppInfo(appid);
                }).css({
                    "background": "#2eacd5"
                })
            }

            if (!reqData.DATA.FRD_PRODUCT_NUM) {
                $(".dispOnFrdNum1010").find("[resultInfoRole]").attr("resultInfoRole", "doNotShow");
                $(".dispOnFrdNum1010 .red-tip").css({
                    display: "block"
                })

                $(".dispOnFrdNum1000 .red-tip").remove();
            }
            else {
                console.log(reqData.DATA.FRD_PRODUCT_NUM)
                if (reqData.DATA.FRD_PRODUCT_NUM.indexOf("AFP1011") != -1) {
                    //多机构申请情况1011风险评级字段展示去掉
                    $("[resultInfoRole='STAN_RISK_RATE']").parent("tr").find("td").css('visibility', 'hidden');
                    //多机构申请情况七天内
                    $('.selectedOrgApplyTable').find('td:first').html("信用卡");
                    $('.selectedOrgApplyTable').find('td:eq(1)').attr("resultinforole", 'ID_ORG_CREDITCARD_7');
                    $('.selectedOrgApplyTable').find('tbody:first').before("<tr><td class='org-apply-item'>申请机构数</td><td resultinforole='ID_ORG_7' colspan='7'></td></tr>");
                    //多机构申请30天内
                    $('.tableWarp').find('tbody:eq(1)').find('td:first').html("信用卡");
                    $('.tableWarp').find('tbody:eq(1)').find('td:eq(1)').attr("resultinforole", 'ID_ORG_CREDITCARD_30');
                    $('.tableWarp').find('tbody:eq(1)').before("<tr><td class='org-apply-item'>申请机构数</td><td resultinforole='ID_ORG_30' colspan='7'></td></tr>");
                    //信息表更情况
                    $('.info-table.widthfull.have-city-span:first').find('tbody:first').before("<tr><td class='item-name'>信息变更</td><td resultinforole='INFO_CHANGE'></td></tr>");
                    $('.info-table.widthfull.have-city-span:first').find('tbody:first').before("<tr><td class='item-name'>多项信息变更</td><td resultinforole='MULTI_INFO_CHANGE'></td></tr>");
                    $('.info-table.widthfull.have-city-span:first').find('tbody:first').before("<tr><td class='item-name'>多单位信息</td><td resultinforole='MULTI_EMP_INFO'></td></tr>");
                    $('.info-table.widthfull.have-city-span:first').find('tbody:first').before("<tr><td class='item-name'>多家庭信息</td><td resultinforole='MULTI_HOME_INFO'></td></tr>");
                    $('.info-table.widthfull.have-city-span:first').find('tbody:first').before("<tr><td class='item-name'>多城市</td><td resultinforole='ID_CITYS'></td></tr>");
                    //信息一致性比对和信息交叉使用
                    $('#infoCheck').show();
                    $('#infoIntersect').show();
                }

                if (reqData.DATA.FRD_PRODUCT_NUM.indexOf("AFP1010") != -1 || reqData.DATA.FRD_PRODUCT_NUM.indexOf("AFP1011") != -1) {
                    $(".dispOnFrdNum1010 .red-tip").remove();
                } else {
                    $(".dispOnFrdNum1010").find("[resultInfoRole]").attr("resultInfoRole", "doNotShow");
                    $(".dispOnFrdNum1010 .red-tip").css({
                        display: "block"
                    })
                }

                if (reqData.DATA.FRD_PRODUCT_NUM.indexOf("AFP1001") != -1) {
                    //欺诈评级执行结果1001新增风险评级
                    $(".dispOnFrdNum1000").children('.info-table.aborder').find('tr:eq(2)').after("<tr><td class='item-name'>风险评级 :</td><td resultinforole='STAN_RISK_RATE'></td></tr>");
                }

                if (reqData.DATA.FRD_PRODUCT_NUM.indexOf("AFP1000") != -1 || reqData.DATA.FRD_PRODUCT_NUM.indexOf("AFP1001") != -1) {
                    $(".dispOnFrdNum1000 .red-tip").remove();
                } else {
                    $(".dispOnFrdNum1000").find("[resultInfoRole]").attr("resultInfoRole", "doNotShow");
                    $(".dispOnFrdNum1000 .red-tip").css({
                        display: "block"
                    })
                }
            }

            var renderAppReqData = formatterReqData(reqData.DATA);
            console.log(renderAppReqData)
            renderAppReqData = filterData(renderAppReqData);
            for (var key in renderAppReqData) {
                $('[applyInfoRole=' + key + ']').map(function () {
                    $(this).html(renderAppReqData[key])
                });
            }
            var appid = getUrlParameters("APP_ID");
            getAppRst(appid);
            /*能拿到FRD_PRODUCT_NUM，再获取调apprst接口*/
        }
    }
}

function renderAppRst(rstData) {
    if (!isEmpty(rstData)) {
        if (rstData.RET_CODE === "00") {
            var renderAppRstData = formatterRstData(rstData.DATA);
            for (var key in renderAppRstData) {
                $('[resultInfoRole=' + key + ']').map(function () {
                    $(this).html(renderAppRstData[key])
                });
            }
        }
    }
}

function setupExtLinks(appid) {
    $('.inquiryBtn').bind('click', function () {
        doInquiry(appid, ORG_NUM);
    });
}

function doViewAppInfo(appId) {
    window.open('relations.html?APP_ID=' + appId);
}

function doInquiry(appId, orgNum) {
    window.open('checkResult.html?APP_ID=' + appId + '&ORG_NUM=' + orgNum);
}
// where to call: href='xxxx/appInfo.html?APP_ID=123'
$(function () {
    var appid = getUrlParameters("APP_ID");
    getProduct();
    if (!isEmpty(appid)) {
        getAppReq(appid);
        setupExtLinks(appid);
    }
})

function flushCheckList() {
    if (window.opener.flushCheckList) {
        window.opener.flushCheckList();
    }
}
/*绑定事件*/
$(document).ready(function () {
    $(".apply-click").bind("click", function () {
        $(".com-width>div").removeClass("clicked-form");
        $(".clickd-title").removeClass("clickd-title");
        $("#apply-info").addClass("clicked-form");
        $(this).addClass("clickd-title");
    });
    $(".result-click").bind("click", function () {
        $(".com-width>div").removeClass("clicked-form");
        $(".clickd-title").removeClass("clickd-title");
        $("#result-info").addClass("clicked-form");
        $(this).addClass("clickd-title");
    });
    $(".sub-title").bind("click", function () {
        var _self = $(this);
        _self.hasClass("open") ? _self.parent().find(".info-table").slideDown(function () {
            _self.removeClass("open");
        }) : _self.parent().find(".info-table").slideUp(function () {
            _self.addClass("open");
        })
    });
    $(".checkApplyInfo").delegate("span", "click", function () {
        if (!$(this).hasClass("selsctedDays")) {
            $(this).parent().find(".selsctedDays").removeClass("selsctedDays");
            $(this).addClass("selsctedDays");
            $(".selectedOrgApplyTable").slideToggle(200);
            /*$(".orgApplyInfo .tableWarp").find("div").map(function() {
             $(this).hasClass("selectedOrgApplyTable") ? (function(){

             $(this).removeClass("selectedOrgApplyTable")
             })() : (function(){
             $(this).addClass("selectedOrgApplyTable")
             })();
             })*/
        }
    });
    $(".checkOperatorsInfo").delegate("span", "click", function () {
        if (!$(this).hasClass("selsctedOperators")) {
            $(".operatorsInfo").find(".selsctedOperatorsTab").removeClass("selsctedOperatorsTab");
            $("." + this.className + "InfoTab").addClass("selsctedOperatorsTab");
            $(this).parent().find(".selsctedOperators").removeClass("selsctedOperators");
            $(this).addClass("selsctedOperators");
        }
    });
    $(".checkContactInfo").delegate("span", "click", function () {
        if (!$(this).hasClass("selsctedContactType")) {
            $(".contactInfo").find(".selsctedContactTable").removeClass("selsctedContactTable");
            $("." + this.className + "InfoTab").addClass("selsctedContactTable");
            $(this).parent().find(".selsctedContactType").removeClass("selsctedContactType");
            $(this).addClass("selsctedContactType");
        }
    })
})

function formatterRstData(retData) {
    var appRstRenderData = {};
    for (var key in retData) {
        if (key != "G1") {
            appRstRenderData[key] = retData[key];
        } else {
            for (var key in retData.G1) {
                if (key == "ID_CELL_PHONE_CITY_DETAIL" || key == "ID_HOME_ADDR_CITY_DETAIL" || key == "ID_HOME_PHONE_CITY_DETAIL" || key == "ID_EMP_ADDR_CITY_DETAIL" || key == "ID_EMP_PHONE_CITY_DETAIL" || key == "ID_CS_CITY_DETAIL") {
                    idCityformatter(key, retData.G1);
                }
                if (key == "CELL_PHONE_CONSISTENCY_CHECK" || key == "EMAIL_CONSISTENCY_CHECK" || key == "HOME_ADDR_CONSISTENCY_CHECK" || key == "HOME_PHONE_CONSISTENCY_CHECK" || key == "EMP_NAME_CONSISTENCY_CHECK" || key == "EMP_ADDR_CONSISTENCY_CHECK" || key == "EMP_PHONE_CONSISTENCY_CHECK" || key == "CS_PHONE_CONSISTENCY_CHECK") {
                    checkInfoFormatter(key, retData.G1)
                }
                appRstRenderData[key] = retData.G1[key];
            }
        }
    }
    for (var key in ServiceResultMap) {
        if (!!key && appRstRenderData[key] != undefined) {
            appRstRenderData[key] = !!ServiceResultMap[key][appRstRenderData[key]] ? ServiceResultMap[key][appRstRenderData[key]] : "输入字段非法"
        }
    }
    return appRstRenderData;

    function idCityformatter(idKey, idCityDetail) {
        var tempStr = "";
        idCityDetail[idKey] = idCityDetail[idKey].replace(/\d+\:/, function (match) {
            tempStr = match.replace(/\:/, "") + "&nbsp&nbsp&nbsp";
            return ""
        }).split("|");
        for (var i = 0; i < idCityDetail[idKey].length; i++) {
            tempStr += '<span>' + idCityDetail[idKey][i] + '</span>';
        }
        idCityDetail[idKey] = tempStr;
    }

    function checkInfoFormatter(checkKey, checkInfoDetail) {
        var split = checkInfoDetail[checkKey].split(";");
        var result = "";
        if (split.length > 1) {
            for(var i=0;i<split.length;i++) {
                if (i!=split.length-1) {
                    result =result+ '<span>' + split[i] + '</span>'+"&nbsp&nbsp&nbsp";
                }
            }
            checkInfoDetail[checkKey] = result;
        }
    }
}

function formatterReqData(reqData) {
    var appReqRenderData = {};
    for (var key in reqData) {
        appReqRenderData[key] = reqData[key];
    }
    if (!!appReqRenderData.CONTACT_LIST) { //通讯录处理
        var tempStr = "";
        appReqRenderData.CONTACT_LIST = appReqRenderData.CONTACT_LIST.split("|");
        for (var i = 0; i < appReqRenderData.CONTACT_LIST.length; i++) {
            tempStr += '<li>' + appReqRenderData.CONTACT_LIST[i] + '</li>';
        }
        appReqRenderData.CONTACT_LIST = tempStr;
    }
    if (!!appReqRenderData.CALL_RECENTS) { //通话记录处理
        tempStr = "";
        appReqRenderData.CALL_RECENTS = appReqRenderData.CALL_RECENTS.split("|");
        for (var i = 0; i < appReqRenderData.CALL_RECENTS.length; i++) {
            tempStr += '<li>' + appReqRenderData.CALL_RECENTS[i] + '</li>';
        }
        appReqRenderData.CALL_RECENTS = tempStr;
    }
    if (!!appReqRenderData.EBIZ_ORDERS_INFO) { //电商收货信息处理
        tempStr = "";
        appReqRenderData.EBIZ_ORDERS_INFO = appReqRenderData.EBIZ_ORDERS_INFO.split("|");
        for (var i = 0; i < appReqRenderData.EBIZ_ORDERS_INFO.length; i++) {
            tempStr += '<li>' + appReqRenderData.EBIZ_ORDERS_INFO[i] + '</li>';
        }
        appReqRenderData.EBIZ_ORDERS_INFO = tempStr;
    }
    if (!!appReqRenderData.EBIZ_ORDERS_SELLER) { //卖家或收货人信息处理
        tempStr = "";
        appReqRenderData.EBIZ_ORDERS_SELLER = appReqRenderData.EBIZ_ORDERS_SELLER.split("|");
        for (var i = 0; i < appReqRenderData.EBIZ_ORDERS_SELLER.length; i++) {
            tempStr += '<li>' + appReqRenderData.EBIZ_ORDERS_SELLER[i] + '</li>';
        }
        appReqRenderData.EBIZ_ORDERS_SELLER = tempStr;
    }
    for (var key in ApplyResultMap) {
        if (!!key && appReqRenderData[key] != undefined) {
            appReqRenderData[key] = !!ApplyResultMap[key][appReqRenderData[key]] ? ApplyResultMap[key][appReqRenderData[key]] : "输入字段非法"
        }
    }
    return appReqRenderData;
}
// 字典常用公共部分
var commonMap = {
    "ID_TYPE": {
        "0": "身份证",
        "1": "户口簿",
        "2": "护照",
        "3": "军官证",
        "4": "士兵证",
        "5": "港澳居民往来内地通行证",
        "6": "台湾同胞往来内地通行证",
        "8": "外国人居留证",
        "9": "警官证",
        "X": "其他证件"
    },
    "RELATION": {
        "0": "父母",
        "1": "子女",
        "2": "配偶",
        "3": "其他亲属",
        "4": "朋友",
        "5": "同事",
        "9": "其他"
    }
}
/*服务结果信息字典*/
var ServiceResultMap = {
    // rst
    "APP_STATUS": {
        "0": "执行成功",
        "1": "数据错误，无执行结果",
        "2": "数据报警，有执行结果，但可能有部分结果无法反馈"
    },
    // services
    /*"STAN_STATUS_B001": {
     "1": "是",
     "2": "否",
     "3": "",
     "4": "",
     "31": ""
     },*/
    /*"STAN_ID_NAME_MATCH": {
     "1": "匹配",
     "2": "不匹配",
     "3": "无此号码"
     },*/
    /*"STAN_STATUS_3007": {
     "1": "是",
     "2": "否",
     "3": "",
     "4": "",
     "31": ""
     },*/
    /*"STAN_8007_INTIMACY_1": {
     "0": "未知",
     "1": "密切",
     "2": "一般",
     "3": "无关系"
     },*/
    /*"STAN_8007_INTIMACY_2": {
     "0": "未知",
     "1": "密切",
     "2": "一般",
     "3": "无关系"
     },*/
    "APP_VALID": {
        "0000": "校验成功，执行后续任务",
        "E001": "数据错误，必填项为空",
        "E002": "数据错误，必填项字段超长",
        "E003": "数据错误，必填项未按照数据字典填写",
        "E004": "数据错误，机构号错误",
        "E005": "数据错误，申请编号不唯一",
        "E006": "数据错误，证件号码为明文时，18位身份证不符合编码规则",
        "E007": "数据错误，手机号码为明文时，手机号不符合编码规则",
        "E008": "数据错误，必填项日期/时间格式错误",
        "W000": "数据报警，忽略报警，执行后续任务",
        "W001": "数据报警，使用手机行为信息服务，手机号、联系人1/2手机号为空或密文",
        "W002": "数据报警，使用身份验证信息服务，身份证号为空或密文/姓名为空",
        "W003": "数据报警，使用运营商信息服务（移动电话信息），手机号为空或密文",
        "W004": "数据报警，使用运营商信息服务（单位电话信息），单位电话为空或密文",
        "W005": "数据报警，使用运营商信息服务（家庭电话信息），家庭电话为空或密文",
        "W006": "数据报警，使用涉诉风险信息服务，身份证号为空或密文/姓名为空",
        "W007": "数据报警，使用不良信息服务，身份证号为空或密文/姓名为空",
        "W008": "数据报警，使用征信共享黑名单服务，身份证号为空或密文/姓名为空",
    },
    "STAN_EXTERNAL_STATUS": {
        "0": " 执行成功",
        "1": "余额不足，无接口服务结果，可执行反欺诈服务",
        "2": " 服务权限问题，无接口服务结果，可执行反欺诈服务",
        "3": "其他问题，无接口服务结果，可执行反欺诈服务",
    },
    "LOAN_TYPE": {
        "AT1": "现金贷款",
        "AT2": "消费贷款",
        "AT3": "发薪日贷款",
        "AT4": "企业经营贷",
        "AT5": "融资租赁",
        "ATZ": "其他贷款",
    }
};
/*申请信息结果字典*/
var ApplyResultMap = {
    "FRD_DATA_NUM": {
        "1": "全明文",
        "2": "申请人证件号码加密",
        "3": "申请人手机号加密",
        "9": "申请人证件号码、手机号皆加密"
    },
    "APP_STATUS": {
        "0": "执行成功",
        "1": "数据错误，无执行结果",
        "2": "数据报警，有执行结果，但可能有部分结果无法反馈",
    },
    "ID_TYPE": commonMap.ID_TYPE,
    "SALES_ID_TYPE": commonMap.ID_TYPE,
    "MATE_ID_TYPE": commonMap.ID_TYPE,
    "GUARANTEE_TYPE": {
        "1": "个人担保",
        "2": "公司担保",
    },
    "GUARANTOR_ID_TYPE": {
        "0": "身份证",
        "1": "户口簿",
        "2": "护照",
        "3": "军官证",
        "4": "士兵证",
        "5": "港澳居民往来内地通行证",
        "6": "台湾同胞往来内地通行证",
        "8": "外国人居留证",
        "9": "警官证",
        "X": "其他证件",
        "F": "工商注册号",
        "G": "组织机构代码",
        "H": "三证合一证代码",
    },
    "APP_GEO_COORD_TYPE": {
        "1": "地球坐标系（WGS84）",
        "2": "火星坐标系（GCJ-02）",
        "3": "百度坐标系（BD-09）",
    },
    "SALES_ID_TYPE": commonMap.ID_TYPE,
    "SALES_GEO_COORD_TYPE": {
        "1": "地球坐标系（WGS84）",
        "2": "火星坐标系（GCJ-02）",
        "3": "百度坐标系（BD-09）",
    },
    "CONSUME_TYPE": {
        "1": "生活日用",
        "2": "服装家纺",
        "3": "家用电器",
        "4": "手机数码",
        "5": "医药保健美容",
        "6": "奢品礼品",
        "7": "教育",
        "8": "汽车",
        "9": "房屋",
        "10": "家装",
        "11": "电动车",
    },
    "NETWORK_TYPE": {
        "1": "WiFi",
        "2": "移动蜂窝网络",
        "3": "有线",
    },
    "APP_LOAN_TYPE": {
        "1": "信用贷款",
        "2": "循环信用贷款",
        "3": "融资租赁",
        "5": "房产抵押贷款",
        "6": "车辆抵押贷款",
        "Z": "其他贷款"
    },
    "GENDER": {
        "1": "男性",
        "2": "女性",
        "9": "未知"
    },
    "MARRIAGE": {
        "10": "未婚",
        "20": "已婚",
        "21": "初婚",
        "22": "再婚",
        "23": "复婚",
        "30": "丧偶",
        "40": "离婚",
        "90": "未说明的婚姻状况"
    },
    "EDUCATION": {
        "10": "研究生及以上",
        "20": "本科",
        "30": "大专",
        "40": "中专",
        "50": "技术学校",
        "60": "高中",
        "70": "初中",
        "80": "小学",
        "90": "文盲或半文盲",
        "99": "未知"
    },
    "HOUSING": {
        "1": "自有住房",
        "2": "租用",
        "3": "与父母同住",
        "4": "借住",
        "9": "其他"
    },
    "C_1_RELATION": commonMap.RELATION,
    "C_2_RELATION": commonMap.RELATION,
    "C_3_RELATION": commonMap.RELATION,
    "C_4_RELATION": commonMap.RELATION,
    "C_5_RELATION": commonMap.RELATION,
}

function filterData(data){
    if (data.FRD_PRODUCT_NUM){
        var product = data.FRD_PRODUCT_NUM;
        data.FRD_PRODUCT_NUM = product.replace("AFP1001", "欺诈评级").replace("AFP1011", "多机构申请");
    
    }
    if (data.APP_PRODUCT_NUM) {
        data.APP_PRODUCT_NUM = product_obj[data.APP_PRODUCT_NUM];
    
    }
    return data

}